﻿@model SnippetBox.Web.Models.LoginModel
@{
    ViewBag.Title = "Login";
    Layout = Settings.Current.Permissions.RequireLogin ? "~/Views/Shared/_BareLayout.cshtml" : "~/Views/Shared/_Layout.cshtml";   
}

@if (!Settings.Current.Permissions.RequireLogin) {
    <h1>Login</h1>
}
<article id="login">
    @using (Html.BeginForm("Login", "User", new { returnUrl = Request.QueryString["returnUrl"] })) {
        @Html.ValidationSummary()
        @Html.AntiForgeryToken()

        <div class="fieldRow">
            <label for="Username">Username</label>
            @Html.TextBoxFor(m => m.Username)
        </div>
        
        <div class="fieldRow">
            <label for="Password">Password</label>
            @Html.PasswordFor(m => m.Password)
        </div>
    
        <div class="buttonRow compactForm">
            @if (Settings.Current.Permissions.AllowRegistration) {
               <p class="actionText">Don't have an account yet? <a href="@Url.Action("Register", "User")">Register here</a></p>
            }
            <input type="submit" value="Login" />
        </div>
    }
</article>

<script src="@Url.Content("~/assets/scripts/lib/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/assets/scripts/lib/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
